home *** CD-ROM | disk | FTP | other *** search
- Path: newsbf02.news.aol.com!not-for-mail
- From: kasslar@aol.com (Kasslar)
- Newsgroups: comp.lang.c++
- Subject: Re: Order of initialisation of static globals
- Date: 27 Feb 1996 14:22:38 -0500
- Organization: America Online, Inc. (1-800-827-6364)
- Sender: root@newsbf02.news.aol.com
- Message-ID: <4gvllu$ru@newsbf02.news.aol.com>
- References: <DMtrnr.Mo8.0.-s@cs.vu.nl>
- Reply-To: kasslar@aol.com (Kasslar)
- NNTP-Posting-Host: newsbf02.mail.aol.com
-
- This is a well known problem and is fully explained in "The Annotated C++
- Reference Manual", Ellis, April 1995, Addison Wesley Publishing - Page 19
- last paragraph. Look at the source code for the iostream library, cin &
- cout are handled just this way. I choose to live by the statement, "it is
- usually wise to avoid dependencys on dynamic initialization order".
-
- If you still don't have the manual handy note that each "translation unit"
- is initialized before its first use which is not always posible. A
- tolerable solution is to put the statics in the same code module so that
- you can order them appropriatly.
-
- Regards,
- Randy Abernethy
- ----------------------------------------
- Randy Abernethy
- Kasslar Enterprises
- kasslar@aol.com
- randya@spectralinc.com
- rabernethy@spectralinc.com
- ----------------------------------------
-